Ext.define("wmf.store.product.product", {
    extend: "Ext.data.Store",
    model: "wmf.model.product.product",
	requires: [
	],
	rootVisible: true,
	pageSize: 20,
    proxy: {
        type: 'ajax',
        url: 'product/getProductList.do',
        reader: {
            type: 'json',
            root: 'list'
        }
    },
    listeners : {  
        beforeload : function(store, operation) {  
        	var page = operation.page;
        	var start = (page-1) * 20;
        	if(wmf.product.init == true){
        		wmf.product.params.start = 0;
        		wmf.product.init = false;
        	}else{
        		wmf.product.params.start = start;
        	}
        	wmf.product.params.limit = 20;
            var params = wmf.product.params;  
            store.proxy.extraParams = {};
       		Ext.apply(store.proxy.extraParams, params);
        }  
    },
	storeId: 'product.product'
});